package com.cheng.io;

import java.util.ResourceBundle;

/**
 * 使用ResourceBundle读取properties文件
 */
public class ResourceBundleLoadProperties {
    public static void main(String[] args) {
        // 获取资源绑定器对象，参数只能为类路径并且不能带后缀
        ResourceBundle resourceBundle = ResourceBundle.getBundle("com.cheng.io.jdbc");
        // 使用/替换.分隔符
        // ResourceBundle resourceBundle = ResourceBundle.getBundle("com/cheng/io/jdbc");

        // 通过key获取value
        String username = resourceBundle.getString("username");
        System.out.println(username);

    }
}
